package mybatis.test;
import mybatis.MyBatisUtils;
import mybatis.mapper.UserMapper;
import mybatis.pojo.User;
import org.apache.ibatis.session.SqlSession;

public class Part11_Insert {
    public static void main(String[] args) {
        SqlSession sqlSession = MyBatisUtils.getSession();
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);

        User user4Insert = new User("ikun",20);

        int nVa = userMapper.addUser(user4Insert);
        System.out.println(nVa);
        System.out.println(user4Insert.getId());


        sqlSession.commit();
        sqlSession.close();
    }
}

